﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="MenuList.aspx.cs" Inherits="admin_system_MenuList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head_Title" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head" runat="Server">
    <script src="/Plugin/jqueryEasyui/jquery.easyui.min.js" type="text/javascript"></script>
    <link href="/Plugin/jqueryEasyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="/Plugin/jqueryEasyui/themes/icon.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Title" runat="Server">
    系统管理 - 菜单管理
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Control" runat="Server">
    <input type="button" value="添加" onclick="AddAlter()" />
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Content" runat="Server">
    <script language="javascript" type="text/javascript">

        //readLoad
        $(function () {

            //只绘制TreeGrid , TreeGrid的数据在Combobox数据加载完成后，初始化选择项目时onSelect中执行，
            $('#tg').treegrid({
                url: 'MenuList.aspx?fun=getMenu',
                idField: 'ID',
                treeField: 'Name',
                height: $("#div_list").parent().height() -10,
                columns: [[
                        { title: '菜单名称', field: 'Name', width: 400 },
                        { title: '菜单Url', field: 'Url', width: 400 },
                        { title: '操作', field: 'Tools', width: 200, align: 'center' }
                    ]]
            });

        });  //end readLoad


        var WinResize = function () {
            var h = $("#div_list").parent().height();
            $('#tg').treegrid("resize", { height: h-10 });
        }

        //按钮“添加”事件
        var AddAlter = function () {
            art.dialog.open('<%=MyUrl.ToAb("~/Admin/system/") %>MenuDetail.aspx?fun=add_Load',
                            {
                                title: "添加菜单",
                                id: 'AddAlter',
                                lock: true,
                                width: 820,
                                height: 385,
                                close: function () {
                                }
                            });
        };

        //按钮“编辑”事件
        var EditAlter = function (mid) {
            //获取要编辑的数据
            art.dialog.data("editData", $('#tg').treegrid("find", mid));

            //弹出编辑页面
            art.dialog.open('<%=MyUrl.ToAb("~/Admin/system/") %>MenuDetail.aspx?fun=edit_Load&mid=' + mid,
                            {
                                title: "编辑菜单",
                                id: 'EditAlter',
                                lock: true,
                                width: 820,
                                height:385,
                                close: function () {
                                    art.dialog.removeData("editData");
                                }
                            });
        };

        //按钮 “同级排序”事件
        var SortAlter = function (pid) {
            art.dialog.open('<%=MyUrl.ToAb("~/Admin/system/") %>sortTable.aspx?pid=' + pid,
                            {
                                title: "菜单排序",
                                id: 'SortAlter',
                                lock: true,
                                ok: true,
                                close: function () {

                                }
                            });
        };

        //按钮 “删除”事件
        var deleteAlter = function (id) {
            artDialog.confirm(
                "确定要删除此项吗？",
                function () {
                    $.get("/Admin/system/MenuDetail.aspx?fun=delMenu&id=" + id,
                        function (data) {
                            data = $.parseJSON(data);
                            if (data.status == "y") {
                                artDialog.alert(data.info);
                                $('#tg').treegrid("reload");
                            }
                        }
                    );
                })
        };

    </script>
    <div id="div_list" style="margin-top: 5px; border-bottom: 1px solid #ccc;">
        <table id="tg" class="easyui-treegrid">
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Foot" runat="Server">
</asp:Content>
